﻿using System;
using System.Windows.Media;

namespace SilverChart.Core.Configuration {
    public class BrushValueItemHelper : AbstractValueItemHelper<Brush> {
        private Boolean isUseColor;
        private Color defaultColor;
        private Brush defaultBrush;

        public BrushValueItemHelper(ConfigurationItem parentItem, String itemName, Color defaultColor)
            : base(parentItem, itemName) {
            defaultBrush = null;
            isUseColor = true;
            this.defaultColor = defaultColor;
        }

        public BrushValueItemHelper(ConfigurationItem parentItem, String itemName, Brush defaultBrush)
            : base(parentItem, itemName) {
            isUseColor = false;
            this.defaultBrush = defaultBrush;
        }

        protected override Brush GetDefaultValue() {
            return isUseColor ? new SolidColorBrush(defaultColor) : defaultBrush;
        }
    }
}
